Hi all, I'm trying to get the following test2 function to work like the Array get function; i.e. a function that can return any type that is cast to the correct type when calling the function. What do I need to change. As you can see, test1 works, but I can't get it to work as a function.
The line calling the test2 function results in an "unassigned variable reference" error.
Any help is appreciated.
Regards, M_vdLaan - Tue Nov 05 09:36:33 EST 2013 |
Re: Returning generic data types M_vdLaan, I have tried this in the past with no luck. I played with it again and still no luck. Please see the following threads:
GothSloth |
Re: Returning generic data types GothSloth - Tue Nov 05 11:43:43 EST 2013 M_vdLaan, I have tried this in the past with no luck. I played with it again and still no luck. Please see the following threads:
GothSloth Hi, Have you tried with a DxlObject?
{code}
DxlObject d = new
d->"data" = "lorem ipsum"
string s
s = (string d->"data")
print s
delete d
{code} This can be a solution. With the disadvantage to have to free the memory... Alain
|
Re: Returning generic data types You need to use reference parameters to have a function return multiple types. The DXL Interpreter does not handle return values well and does not work at all for returning underscore types. So do something like this:
Regards, Mathias |
Re: Returning generic data types Mathias Mamsch - Wed Nov 06 08:39:41 EST 2013 You need to use reference parameters to have a function return multiple types. The DXL Interpreter does not handle return values well and does not work at all for returning underscore types. So do something like this:
Regards, Mathias Okay,
Thanks all. So to summarize, it's not (reliably) possible to create a function similar to the Array get() function. I am aware of the alternatives (the _m parameter as used by the Skip find() function and the DxlObject field return method). Since I was playing around with an Array wrapper, I wanted to use a wrapper around the Array get() function.
Guess I'll work around this.
Thanks, M_vdLaan |